﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace TVC_WEB.Global
{
    public partial class Register : System.Web.UI.Page
    {
        String sErr = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            txtCormPass.Attributes["onkeyup"] = "checkpass()";

            txtEmail.Attributes["onkeyup"] = "CheckMail()";
            if (Session["Usernamenew"] != null)
            {
                txtEmail.Text = Session["Usernamenew"].ToString();
            }
        }

        protected void txtContinue_Click(object sender, EventArgs e)
        {
            if (txtPass.Text.Trim() == txtCormPass.Text.Trim())
            {
                BUS.UserControl userctr = new BUS.UserControl();
                DTO.UserInfo userinf = new DTO.UserInfo();
                userinf.Email = txtEmail.Text;
                userinf.Password = txtPass.Text;

                if (!userctr.IsExist_Users_Name(userinf.Email))
                {
                    userctr.Add(userinf, ref sErr);

                    if (sErr == "")
                    {
                        Session["Username"] = Session["Usernamenew"];
                        Session["Usernamenew"] = null;
                        Response.Redirect("User.aspx");
                    }
                }
                else
                {
                    lbvademail.Text = "Email is existed !!!";
                }
            }
         
        }
    }
}
